/*
 * Copyright 2006 Google Inc.
 * 
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
 * use this file except in compliance with the License. You may obtain a copy of
 * the License at
 * 
 * http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations under
 * the License.
 */
package com.google.gwt.user.client.ui.impl;

import com.google.gwt.user.client.Element;

/**
 * TODO
 */
public class PopupImplIE6 extends PopupImpl {

  public native Element createElement() /*-{
    var outer = $doc.createElement('div');
    var frame = $doc.createElement('iframe');
  
    outer.appendChild(frame);
    frame.scrolling = 'no';
    frame.style.zIndex = -1;
    frame.frameBorder = 0;
  
    outer.style.position = 'absolute';
    frame.style.position = 'absolute';
    return outer;
  }-*/;

  public native void setClassName(Element popup, String className) /*-{
    popup.children[1].className = className;
  }-*/;
  
  public native void fixup(Element popup) /*-{
    popup.children[0].style.width = popup.children[1].offsetWidth;
    popup.children[0].style.height = popup.children[1].offsetHeight;
  }-*/;
  
  public native void setChild(Element popup, Element child) /*-{
    if (popup.children.length == 2)
      popup.removeChild(popup.children[1]);
    popup.appendChild(child);
  }-*/;
  
  public native void setHeight(Element popup, String height) /*-{
    popup.style.height = popup.children[0].style.height = popup.children[1].style.height = height;
  }-*/;
  
  public native void setWidth(Element popup, String width) /*-{
    popup.style.width = popup.children[0].style.width = popup.children[1].style.width = width;
  }-*/;
}
